import React, { Component } from 'react'
import Detail from './Detail'
import { NavLink, BrowserRouter as Router, Route, Redirect } from 'react-router-dom'
import './index.css'
export default class Home extends Component {
  render() {
    return (
      <Router>
        <div>
          <h3>Home</h3>
          <ul>
            <li>
              <NavLink to="/detail/1">商品1</NavLink>
            </li>
            <li>
              <NavLink to="/detail/2">商品2</NavLink>
            </li>
            <li>
              <NavLink to="/detail/3">商品3</NavLink>
            </li>
          </ul>
        </div>
        <Redirect exact from="/home" to="/detail/1"></Redirect>
        <Route path="/detail/:id" component={Detail}></Route>
      </Router>
    )
  }
}
